package cn.jroid.demo.entity;

import org.json.JSONException;
import org.json.JSONObject;

import android.util.Log;

public class User {
	private String username;
	private String content;
	
	public User() {
		
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Override
	public String toString() {
		return "User [username=" + username + ", content=" + content + "]";
	}
	
	public static User parse(String jsonContent) {
		User user = new User();
		
		try {
			JSONObject jsonObject = new JSONObject(jsonContent);
			String username = jsonObject.getString("username");
			String content = jsonObject.getString("content");
			user.setUsername(username);
			user.setContent(content);
			
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
		
		return user;
	}
}
